package com.credithc.customers.base.ro;

import com.credithc.customers.base.codes.CustomerCodes;
import com.credithc.customers.base.exception.CustomerException;
import com.credithc.customers.base.utils.CustomerUtils;
import lombok.Data;
import org.apache.commons.lang.StringUtils;

/**
 * @description: 手机号修改
 * @author: fby
 * @date: 2019/7/8 15:47
 * @param: null
 * @return:
 */
@Data
public class UnifyModifyPhoneRo extends CustomerBaseRo {

    private String oldPhone;

    private String newPhone;

    public static void checkBaseParam(UnifyModifyPhoneRo ro) {

        if (StringUtils.isBlank(ro.getOldPhone()) || StringUtils.isBlank(ro.getNewPhone())) {
            throw new CustomerException(CustomerCodes.PARAM_VALIDATE_ERROR, "必填项不能为空!");
        }
        CustomerUtils.checkMobil(ro.getOldPhone());
        CustomerUtils.checkMobil(ro.getNewPhone());
    }
}
